{% extends "meetings/base_rooms_times.html" %}
{% load tz %}
{% block subsection %}

    <div class="module">
        <h2>Times</h2>

        {% if times %}
            <table class="full-width">
                <thead>
                    <tr>
                        <th scope="col">Day</th>
                        <th scope="col">Time</th>
                        <th scope="col">Name</th>
                        <th scope="col"></th>
                        <th scope="col"></th>
                    </tr>
                </thead>
                <tbody>{% timezone meeting.time_zone %}
                    {% for item in times %}
                        <tr class="{% cycle 'row1' 'row2' %}">
                            <td>{{ item.time|date:"D M d" }}</td>
                            <td>{{ item.time|date:"H:i" }} - {{ item.end_time|date:"H:i" }}</td>
                            <td>{{ item.name }}</td>
                            <td><a href="{% url "ietf.secr.meetings.views.times_edit" meeting_id=meeting.number schedule_name=schedule.name time=item.time|date:"Y:m:d:H:i" %}">Edit</a></td>
                            <td><a href="{% url "ietf.secr.meetings.views.times_delete" meeting_id=meeting.number schedule_name=schedule.name time=item.time|date:"Y:m:d:H:i" %}">Delete</a></td>
                        </tr>
                    {% endfor %}
                {% endtimezone %}</tbody>
            </table>
        {% else %}
            <h3>No timeslots exist for this meeting. Add rooms with the "duplicate timeslots" option enabled to copy timeslots from the last meeting.</h3>
        {% endif %}
        <br><hr>

        <form method="post">{% csrf_token %}
            {{ form.non_field_errors }}
            <table id="timeslot-form" class="full-width">
                <tbody>
                <tr>
                    <td>Day<br>{{ form.day.errors }}{{ form.day }}</td>
                    <td>Time<br>{{ form.time.errors }}{{ form.time }}</td>
                    <td>Duration<br>{{ form.duration.errors }}{{ form.duration }}</td>
                    <td>Name<br>{{ form.name.errors }}{{ form.name }}</td>
                    <td><button type="submit" name="submit">Add</button></td>
                </tr>
                </tbody>
            </table>
        </form>

        <div class="button-group">
            <ul>
                <li><button type="button" onclick="window.location='../'">Back</button></li>
            </ul>
        </div>

    </div>

{% endblock %}